Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
var max = setTimeout(";"); can clear all setTimeout events ,but i'm can understand the code
var max = setTimeout(";");
for (var i=1; i< max; i++) clearTimeout(i);

I'm found the code in stack overflow can to clear all setTimeout events,

but how to understand var max = setTimeout(";");? What mean is it?

Here is original question => How to stop all timeouts and intervals using javascript?

Thank you!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

setTimeout returns a numeric ID which can be used to clear the timeout.

Creating a new timeout creates a new ID.

This code assumes that IDs will always be issued in sequential order (although I'm not aware of any implementation which doesn't).

about 4 years ago · Juan Pablo Isaza Report

0

It simply creates empty timeout. And since setTimeout returns it's reference as incremented value, that way you can tell how much timeouts there is on page

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!